<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<html>
  <head>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>微信接口-注册</title>
		<meta name="Keywords" content="微信开发,微信支付,微信demo,demo下载">
		<meta name="description" content="微信开发">
		<jsp:include page="iconfont/iconfont.jsp" flush="true"/><!--动态包含-->
		<!--css,js-->
		<script type="text/javascript" src="<c:url value='/resources/js/jquery-1.10.2.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resources/js/user.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resources/js/jquery.pagination.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resources/js/layer/layer.js'/>"></script>
		<link rel="stylesheet" type="text/css" href="<c:url value='/resources/js/layer/skin/layer.css'/>">
		<link rel="stylesheet" type="text/css" href="<c:url value='/resources/css/pagination.css'/>">
		<link rel="stylesheet" type="text/css" href="<c:url value='/resources/css/style.css'/>">
		<link rel="stylesheet" type="text/css" href="<c:url value='/resources/css/animate.css'/>">
		<link rel="stylesheet" type="text/css" href="<c:url value='/resources/css/app.css'/>"/>
	</head>
		<style type="text/css">
			.tips{margin-left:50px;}
			a{color:#333;}
			h3,h4,span,p,label,a{margin:10px 0;}
			.cnt-box{position:relative;padding:0 36px 48px;box-shadow:0 0px 8px rgba(18,22,27,0.2);margin-top:-40px;}
			.qrcode{position:absolute;top:100px;right:13%;padding:20px 20px 0 20px;background:rgba(194,224,196,0.3);}
			.qrcode img{width:220px;height:auto;}
			.comm{font-size:18px;vertical-align:sub;color:#EF7023;padding:0 2px;}
			.p-cart-title h1{line-height:100px;margin-left:50px;}
			input[type="text"],input[type="password"]{font-family:微软雅黑;}
						
		</style>
	<body style="background: none">
		<div class="register">
			<!-- <div class="logo">
				<i></i>
			</div> -->
			<div class="p-cart-title" style="background: url(<c:url value='/resources/images/cart-header-bg.jpg'/>); height: 130px;">
				<h1>注册</h1>
				<embed style="margin-top: 50px;" src="images/flash2944.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="150" height="auto">
			</div>
			<div class="cnt-box">
				<h3>填写基本信息</h3>
				<ul>
					<li>
						<i class="comm iconfont icon-yonghuming"></i>
						<span>昵称:</span>
						<input type="text" id="nickname" placeholder="昵称" autocomplete="off"/>
					</li>
					<li>
						<i class="comm iconfont icon-yonghuming"></i>
						<span>用户名:</span>
						<input type="text" id="uname" placeholder="手机号/邮箱/QQ号" autocomplete="off"/>
					</li>
					<li>
						<i class="comm iconfont icon-mima"></i>
						<span>密码:</span>
						<input placeholder="请输入密码" type="password" id="pwd" autocomplete="off"/>
					</li>
					<li>
						<i class="comm iconfont icon-mima"></i>
						<span>确认密码:</span>
						<input placeholder="确认密码" type="password" id="cpwd" autocomplete="off"/>
					</li>
					<li>
						<div class="verify-code-box" style="display:inline-block;">
							<i class="comm iconfont icon-yanzhengma"></i>
							<span>验证码:</span>
							
							<div style="display: inline;margin-left: 42px;">
								<input placeholder="请输入验证码" type="text" id="verfifycode" style="width:130px;position: relative;" autocomplete="off"/>
								<img width="100" height="38" style="vertical-align: bottom;" id="num" src="../yzm/yzm.do" onclick="this.src='../yzm/yzm.do?d='+(new Date().getTime())"/>
								<a style="text-decoration:none;color:#008000;font-family:微软雅黑;" href="javascript:;" onclick="document.getElementById('num').src = '../yzm/yzm.do?'+(new Date()).getTime()">换一张</a>
							</div>
							
							<p class="validate-desc" style="color: orange;">扫描右方二维码，可关注更多技术信息。</p>
							<!-- <p class="verify-code">
								<img src="" width="150" height="50"/>
								<a href="#" class="changeVerifyCode">换一张</a>
							</p> -->
							
						</div>
					</li>
					<li>
						<p style="postion:relative;">
							<a href="javascript:;" class="registerbtn animated bounceInLeft">注册</a>
							<a class="gologin" style="color: #459ae9;display:inline-block;position:absolute;right: 118px;bottom: 12px;" href="<c:url value='/user/login.htm'/>">登录</a>
						</p>
					</li>
				</ul>
				
				<!--扫描二维码-->
				<div class="qrcode animated bounceInRight">
					<img src="<c:url value='/resources/images/fuwuhao_qrcode.jpg'/>">
					<p class="gzh-name" style="text-align: center;color:#FF6000;">21号工匠</p>
					<p class="gzh-name" style="text-align: center;color: #B5B3B1;font-size: 14px;">（我们将为您推送更多优秀文章）</p>
				</div>
			</div>
			<!-- <canvas id="canvas"></canvas> -->
			<!-- <script type="text/javascript" src="js/canvas-xinghe.js"></script> -->
			<script type="text/javascript">
				$(document).ready(function(){
					$.user.signup=function(){
						$(".registerbtn").on("click",function(){
							var $nickname=$.trim($("#nickname").val());
							var $uname=$.trim($("#uname").val());
							var $pwd=$.trim($("#pwd").val());
							var $cpwd=$.trim($("#cpwd").val());
							var $vcode=$.trim($("#verfifycode").val());
							if($nickname=="" || $nickname==null){
								$.user.template("你还没填写昵称！");
								return false;
							}
							if($uname=="" || $uname==null){
								$.user.template("你还没输入账号！");
								return false;
							}
							if($pwd=="" || $pwd==null){
								$.user.template("你还没输入密码！");
								return false;
							}
							if($cpwd=="" || $cpwd==null){
								$.user.template("请确认密码！");
								return false;
							}
							if($pwd!=$cpwd){
								$.user.template("两次密码输入不一致");
								return false;
							}
							if($vcode=="" || $vcode==null){
								$.user.template("请输入验证码！");
								return false;
							}
							
							var data={
								username:$uname,
								userpassword:$pwd,
								usernick:$nickname,
								numberyzm:$vcode
							};
							$.ajax({
								url:"<c:url value='/rest/signup'/>",
								method:"GET",
								data:data,
								success:function(e){
									console.log(e);
									if(e=="vali_code_is_null"){
										$.user.template("请输入验证码！");
										return;
									}
									if(e=="vali_code_is_error"){
										$.user.template("验证码错误");
										return;
									}
									if(e=="signup_ok"){
										location.href="<c:url value='/user/login.htm'/>";
									}
								}
								
							});


						});
					}

					$.user.signup();
				});
			</script>
		</div>
	</body>
</html>
